package com.gx.components
{
	import com.gx.core.Component;
	import com.gx.events.TransformEvent;
	import com.gx.interfaces.ILayer;
	import com.gx.interfaces.ISceneObject;
	import com.gx.interfaces.ITickObject;
	import com.gx.sceneGraph.ISceneContainerObject;
	import com.gx.sceneGraph.SceneContainerData;
	
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class SceneObject extends Component implements ISceneObject, ITickObject, ISceneContainerObject
	{
		public function SceneObject()
		{
			this.addEventListener(TransformEvent.TRANSFORM_EVENT, onTransform, false, 0, true);
		}
		
		private function onTransform(e:TransformEvent):void
		{
			this.x = e.matrix.tx;
			this.y = e.matrix.ty;
		}
		
		private var _visible:Boolean;
		public function get visible():Boolean{return _visible;}
		public function set visible(value:Boolean):void{_visible = value;}
		
		private var _layer:ILayer;
		public function get layer():ILayer{return _layer;}
		public function set layer(value:ILayer):void{_layer = value;}

		private var _width:int;
		public function get width():Number{return _width;}
		public function set width(value:Number):void{_width = value};
		
		private var _height:int;
		public function get height():Number{return _height;}
		public function set height(value:Number):void{_height = value;}
		
		private var _position:Point;
		public function get position():Point{return _position;}
		public function set position(value:Point):void{_position = value;}
		
		public function get x():Number{return _position.x;}
		public function set x(value:Number):void{_position.x = value;}
		
		public function get y():Number{return _position.y;}
		public function set y(value:Number):void{_position.y = value;}
		
		private var _rotation:Number;
		public function get rotation():Number{return _rotation;}
		public function set rotation(value:Number):void{_rotation = value;}
		
		private var _sceneContainerData:SceneContainerData;
		public function get sceneContainerData():SceneContainerData{return _sceneContainerData;}
		public function set sceneContainerData(value:SceneContainerData):void{_sceneContainerData = value;}
		
		private var _worldClipRectangle:Rectangle;
		public function get worldClipRectangle():Rectangle{return _worldClipRectangle};
		public function set worldClipRectangle(value:Rectangle):void{_worldClipRectangle = value};
		
		private var _worldCollisionClipRectangle:Rectangle;
		public function get worldCollisionClipRectangle():Rectangle{return _worldCollisionClipRectangle};
		public function set worldCollisionClipRectangle(value:Rectangle):void{_worldCollisionClipRectangle = value};
		
		public function processTick(dt:Number):void
		{
			//TODO: process tick
		}
		
		public function interpolateTick(dt:Number):void
		{
			//TODO: process tick
		}
		
	}
}